<template>
	<!-- 隐私协议 -->
	<view class="box">
		<!-- 顶部导航 -->
		<diyNavBar :value='option.title'></diyNavBar>
		<view class="content">
			<block v-if="type == 'Notice'">
				<image :src="$util.img(data.image)" mode="widthFix"></image>
				<view class="text" v-html='data.context'></view>
			</block>
			<block v-else>
				<view class="title">{{data.title}}</view>
				<view class="text" v-html='data.value'></view>
			</block>

		</view>
		<loading-cover ref="loadingCover"></loading-cover>
	</view>
</template>

<script>
	import loadingCover from '../../component/loading-cover/loading-cover.vue'
	import diyNavBar from '../../component/diy-nav/diy-navbar.vue'
	export default{
		components:{
			loadingCover,diyNavBar
		},
		data(){
			return {
				data:{},
				option:{},
				type:""//当前页面的类型
			}
		},
		onLoad(option) {
			option.title?this.option = option:'';
			uni.setNavigationBarTitle({
				　title:option.title
			})
			this.select(option.type,option.id);
		},
		methods:{
			//选择内容
			select(type,id = ''){
				let judge = false;
				let url = '';
				let data = {};
				this.type = type;
				switch(type){
					case 'Myxy'://用户协议
						url = '/index/Myxy'
						break;
					case 'Policy'://隐私政策
						url = '/index/Policy'
						break;
					case 'Services'://服务协议
						url = '/member/Services'
						judge = true
						break;
					case 'Privacy'://隐私协议
						url = '/member/Privacy'
						judge = true
						break;
					case 'Fbgz'://发布规则
						url = '/index/Fbgz'
						judge = true
						break;
					case 'Notice'://发布规则
						url = '/index/NoticeId'
						judge = true
						data.id = id
						break;
				}
				this.$http.sendrequest(url,data,{
					tokenJudge:judge,
				}).then(res=>{
					if(res.code == 1){
						this.data = res.data;
						this.$refs.loadingCover.hide();
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.box{
		width: 100%;
		min-height: 100vh;
		background: $uni-content-background-color;
		.content{
			margin: 0 30rpx;
			background: #FFFFFF;
			border-radius: 10rpx;
			padding: 20rpx;
			box-sizing: border-box;
			margin-top:30rpx ;
			.title{
				font-size: 36rpx;
				font-weight: bold;
				margin-bottom: 30rpx;
			}
			.text{
				font-size: 28rpx;
				color: #999999;
				text-indent: 2em;
				line-height: 1.5;
			}
		}
	}
</style>
